﻿import 'package:get/get.dart';
import 'status_page.dart';
import 'status_logic.dart';
import 'eidt_cards/edit_cards_view.dart';
import 'eidt_cards/edit_cards_logic.dart';
import 'diet_record/text_record/text_record_view.dart';
import 'diet_record/text_record/text_record_logic.dart';
import '../sleep/sleep_logic.dart';

// 导入所有子模块路由
import 'activity/routes.dart';
import 'blood_oxygen/routes.dart';
import 'calendar/routes.dart';
import 'daily_check_in/routes.dart';
import 'daily_events/routes.dart';
import 'daily_events/event_summary/routes.dart';
import 'diet_record/routes.dart';
import 'diet_record/diet_statistics/routes.dart';
import 'exercise/routes.dart';
import 'heart_rate/routes.dart';
import 'menstrual_cycle/routes.dart';
import 'pressure/routes.dart';

/// 状态模块路由配置
/// 聚合所有子模块路由
class StatusRoutes {
  /// 状态主页
  static const String status = '/status';

  /// 编辑卡片页
  static const String editCards = '/status/edit-cards';

  /// 文字记录页
  static const String textRecord = '/status/text-record';

  static final List<GetPage> routes = [
    // 主页路由
    GetPage(
      name: status,
      page: () => const StatusView(),
      binding: BindingsBuilder(() {
        // 使用 put 而不是 lazyPut，确保立即初始化
        Get.put(StatusLogic());
        // 同时初始化 SleepLogic，因为 SleepView 嵌入在 StatusView 中
        Get.put(SleepLogic());
      }),
    ),
    GetPage(
      name: editCards,
      page: () => const EditCardsView(),
      binding: BindingsBuilder(() {
        Get.lazyPut(() => EditCardsLogic());
      }),
    ),
    GetPage(
      name: textRecord,
      page: () => const TextRecordView(),
      binding: BindingsBuilder(() {
        Get.lazyPut(() => TextRecordLogic());
      }),
    ),
    
    // 聚合所有子模块路由
    ...ActivityRoutes.routes,
    ...BloodOxygenRoutes.routes,
    ...CalendarRoutes.routes,
    ...DailyCheckInRoutes.routes,
    ...DailyEventsRoutes.routes,
    ...EventSummaryRoutes.routes,
    ...DietRecordRoutes.routes,
    ...DietStatisticsRoutes.routes,
    ...ExerciseRoutes.routes,
    ...HeartRateRoutes.routes,
    ...MenstrualCycleRoutes.routes,
    ...PressureRoutes.routes,
  ];
}
